import 'package:dio/dio.dart';
import 'package:intl/intl.dart';

/// 格式化工具类
class FormatUtil {

  ///格式化url,将post和get请求以get链接输出
  static String formattedUrl(params) {
    var urlParamsStr = "";
    if (params?.isNotEmpty ?? false) {
      var tempArr = [];
      params.forEach((k, v) {
        tempArr.add(k + '=' + v.toString());
      });
      urlParamsStr = tempArr.join('&');
    }
    return urlParamsStr;
  }

  static String formatTime(DateTime? dateTime, {String format = "yyyy-MM-dd HH:mm:ss"}) {
    if (dateTime == null) {
      return "";
    }
    return DateFormat(format).format(dateTime);
  }



}
